package ui.panel.towers
{

	import beans.TowerBean;

	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.geom.Rectangle;
	import flash.text.TextField;

	import globals.ButtonType;
	import globals.Global;

	import ui.component.GameTextField;
	import ui.component.Label;
	import ui.component.ScaleBitmap;
	import ui.component.SeparationLine;
	import ui.component.StarRate;
	import ui.component.TextButton;

	import util.ColorUtil;
	import util.TextStyle;
	import util.UIUtil;

	/**炮塔改造后的信息**/
	public class TowerNextInfo extends Sprite
	{
		private var nameLabel:GameTextField;
		private var towerView:Bitmap;
		private var _txtItems:Array = [];

		public function TowerNextInfo()
		{
			super();
			var bg:ScaleBitmap = new ScaleBitmap(Global.assetsManager.getAssetsAsBitmapData("tower_bg", "ui"));
			bg.scale9Grid = new Rectangle(35, 35, 14, 14);
			bg.width = 150;
			bg.height = 350;
			this.addChild(bg);

			nameLabel = new GameTextField();
			nameLabel.defaultTextFormat = TextStyle.getTextFormat(0xFFFFFF, 14, true, "center");
			nameLabel.y = 20;
			nameLabel.width = bg.width;
			this.addChild(nameLabel);

			towerView = new Bitmap();
			ColorUtil.addColorRing(towerView, 0xFFFFFF, 2, 2, 6);
			towerView.y = 50;
			this.addChild(towerView);
			var labelTexts:Array = ["攻击：", "速度：", "职业："];

			for(var i:int = 0; i < 3; i++)
			{
				var label:GameTextField = new GameTextField();
				label.defaultTextFormat = TextStyle.getTextFormat();
				label.mytext = labelTexts[i];
				label.x = 22;
				label.y = 150 + i * 18;
				this.addChild(label);
				////////////值////////////
				var txt:GameTextField = new GameTextField();
				txt.defaultTextFormat = TextStyle.getTextFormat();
				txt.x = label.x + label.width;
				txt.y = label.y;
				this.addChild(txt);
				_txtItems.push(txt);
			}

			var sline:SeparationLine = new SeparationLine(120);
			sline.y = 223;
			sline.x = 15;
			this.addChild(sline);

			var willchange:GameTextField = new GameTextField();
			willchange.defaultTextFormat = TextStyle.getTextFormat(0xFFFFFF, 12, false, "center");
			ColorUtil.addColorRing(willchange, 0x000000, 4, 4, 10);
			//TextStyle.addTextFrame(willchange, 0x000000);
			willchange.width = 150;
			willchange.y = 215;
			willchange.text = "可改建为";
			this.addChild(willchange);

			var nextChange:GameTextField = new GameTextField();
			nextChange.defaultTextFormat = TextStyle.getTextFormat();
			nextChange.x = 35;
			nextChange.y = 236;
			this.addChild(nextChange);
			_txtItems.push(nextChange);

			nextChange = new GameTextField();
			nextChange.defaultTextFormat = TextStyle.getTextFormat();
			nextChange.x = 35;
			nextChange.y = 256;
			this.addChild(nextChange);
			_txtItems.push(nextChange);
			var point:MyPoint;
			point = new MyPoint();
			point.x = 28;
			point.y = 245;
			this.addChild(point);

			point = new MyPoint();
			point.x = 28;
			point.y = 265;
			this.addChild(point);
		}

		public function update():void
		{
			nameLabel.text = "魔法塔";
			towerView.bitmapData = Global.assetsManager.getAssetsAsBitmapData("tower1b");
			towerView.x = (this.width - towerView.width) * 0.5;
			(_txtItems[0] as GameTextField).mytext = "低(爆炸伤害)";
			(_txtItems[1] as GameTextField).mytext = "中";
			(_txtItems[2] as GameTextField).mytext = "弓箭手";
			(_txtItems[3] as GameTextField).mytext = "2级炮塔";
			(_txtItems[4] as GameTextField).mytext = "3级炮塔";
		}

		public function clear():void
		{
			towerView.bitmapData = null;
		}
	}
}
import flash.display.Shape;

class MyPoint extends Shape
{
	public function MyPoint()
	{
		with(this.graphics)
		{
			beginFill(0x4ba2c6);
			drawCircle(0, 0, 4);
			endFill();
		}
	}
}